{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f6687e3e",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "59f5d0f8",
   "metadata": {},
   "outputs": [],
   "source": [
    "s1 = pd.Series(['a','b','c','d'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "1bc4cde5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    a\n",
       "1    b\n",
       "2    c\n",
       "3    d\n",
       "dtype: object"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "5f35a2de",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.series.Series'>\n"
     ]
    }
   ],
   "source": [
    "print(type(s1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "509cc933",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RangeIndex(start=0, stop=4, step=1)\n"
     ]
    }
   ],
   "source": [
    "print(s1.index)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "b0bb0180",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['a', 'b', 'c', 'd'], dtype=object)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1.values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "b33a85c7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'d'"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1.max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "965eb81b",
   "metadata": {},
   "outputs": [],
   "source": [
    "s2 = pd.Series([0,1,2,3],index=['a','b','c','d'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "7ac43534",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "57bc3eb2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    0.000000\n",
       "b    0.841471\n",
       "c    0.909297\n",
       "d    0.141120\n",
       "dtype: float64"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.sin(s2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "7a280494",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    0\n",
       "b    1\n",
       "c    2\n",
       "d    3\n",
       "dtype: int64"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "3ba7cd21",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s2['b']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "8df94b6c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    1\n",
       "b    2\n",
       "dtype: int64"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.Series({'a':1,'b':2})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "883edcba",
   "metadata": {},
   "outputs": [],
   "source": [
    "df1 = pd.DataFrame({\n",
    "    'name':['zhangsan','lisi','wangwu'],\n",
    "    'age':[18,20,22]\n",
    "})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "aec67f78",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n"
     ]
    }
   ],
   "source": [
    "print(type(df1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "af413e35",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>zhangsan</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>lisi</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>wangwu</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       name  age\n",
       "0  zhangsan   18\n",
       "1      lisi   20\n",
       "2    wangwu   22"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "470ce3b7",
   "metadata": {},
   "outputs": [],
   "source": [
    "s3 = df1['name']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "d9f3a0eb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.series.Series'>\n"
     ]
    }
   ],
   "source": [
    "print(type(s3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "366dd284",
   "metadata": {},
   "outputs": [],
   "source": [
    "s4 = df1['age']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "1906cc4a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>zhangsan</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>lisi</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>wangwu</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       name  age\n",
       "0  zhangsan   18\n",
       "1      lisi   20\n",
       "2    wangwu   22"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.DataFrame({\n",
    "    'name':s3,\n",
    "    'age':s4\n",
    "})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "13863a62",
   "metadata": {},
   "outputs": [],
   "source": [
    "stuDF = pd.read_csv(r\"C:\\Users\\zzk10\\PycharmProjects\\pythonProject12\\notebooks\\data\\students.txt\",names=['id','name','age','gender','clazz'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "5b973c4e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "      <th>clazz</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>施笑槐</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>文科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>吕金鹏</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1500100003</td>\n",
       "      <td>单乐蕊</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>理科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100004</td>\n",
       "      <td>葛德曜</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>理科三班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1500100005</td>\n",
       "      <td>宣谷芹</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>理科五班</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           id name  age gender clazz\n",
       "0  1500100001  施笑槐   22      女  文科六班\n",
       "1  1500100002  吕金鹏   24      男  文科六班\n",
       "2  1500100003  单乐蕊   22      女  理科六班\n",
       "3  1500100004  葛德曜   24      男  理科三班\n",
       "4  1500100005  宣谷芹   22      女  理科五班"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stuDF.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "035dad33",
   "metadata": {},
   "outputs": [],
   "source": [
    "stuDF.rename(columns={\"id\":0},inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "b4e498d8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "      <th>clazz</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>施笑槐</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>文科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>吕金鹏</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1500100003</td>\n",
       "      <td>单乐蕊</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>理科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100004</td>\n",
       "      <td>葛德曜</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>理科三班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1500100005</td>\n",
       "      <td>宣谷芹</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>理科五班</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            0 name  age gender clazz\n",
       "0  1500100001  施笑槐   22      女  文科六班\n",
       "1  1500100002  吕金鹏   24      男  文科六班\n",
       "2  1500100003  单乐蕊   22      女  理科六班\n",
       "3  1500100004  葛德曜   24      男  理科三班\n",
       "4  1500100005  宣谷芹   22      女  理科五班"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stuDF.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "93034a58",
   "metadata": {},
   "outputs": [],
   "source": [
    "stuDF.rename(columns={0:'id'},inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "606bb636",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>施笑槐</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>吕金鹏</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1500100003</td>\n",
       "      <td>单乐蕊</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100004</td>\n",
       "      <td>葛德曜</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1500100005</td>\n",
       "      <td>宣谷芹</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>1500100996</td>\n",
       "      <td>厉运凡</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>1500100997</td>\n",
       "      <td>陶敬曦</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>1500100998</td>\n",
       "      <td>容昆宇</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>1500100999</td>\n",
       "      <td>钟绮晴</td>\n",
       "      <td>23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>1500101000</td>\n",
       "      <td>符瑞渊</td>\n",
       "      <td>23</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1000 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             id name  age\n",
       "0    1500100001  施笑槐   22\n",
       "1    1500100002  吕金鹏   24\n",
       "2    1500100003  单乐蕊   22\n",
       "3    1500100004  葛德曜   24\n",
       "4    1500100005  宣谷芹   22\n",
       "..          ...  ...  ...\n",
       "995  1500100996  厉运凡   24\n",
       "996  1500100997  陶敬曦   21\n",
       "997  1500100998  容昆宇   22\n",
       "998  1500100999  钟绮晴   23\n",
       "999  1500101000  符瑞渊   23\n",
       "\n",
       "[1000 rows x 3 columns]"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stuDF[['id','name','age']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "8961890d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "      <th>clazz</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>施笑槐</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>文科六班</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           id name  age gender clazz\n",
       "0  1500100001  施笑槐   22      女  文科六班"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stuDF[0:1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "e7971588",
   "metadata": {},
   "outputs": [],
   "source": [
    "s = stuDF.loc[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "231288f2",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.series.Series'>\n"
     ]
    }
   ],
   "source": [
    "print(type(s))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "1c4f8511",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "      <th>clazz</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>吕金鹏</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100004</td>\n",
       "      <td>葛德曜</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>理科三班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>1500100013</td>\n",
       "      <td>逯君昊</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科二班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>1500100019</td>\n",
       "      <td>娄曦之</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>理科三班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>1500100028</td>\n",
       "      <td>幸浩邈</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>理科五班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>988</th>\n",
       "      <td>1500100989</td>\n",
       "      <td>柏盼香</td>\n",
       "      <td>24</td>\n",
       "      <td>女</td>\n",
       "      <td>理科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>991</th>\n",
       "      <td>1500100992</td>\n",
       "      <td>莫运盛</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>理科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>993</th>\n",
       "      <td>1500100994</td>\n",
       "      <td>相凌青</td>\n",
       "      <td>24</td>\n",
       "      <td>女</td>\n",
       "      <td>理科四班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>994</th>\n",
       "      <td>1500100995</td>\n",
       "      <td>寿芷卉</td>\n",
       "      <td>24</td>\n",
       "      <td>女</td>\n",
       "      <td>理科五班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>1500100996</td>\n",
       "      <td>厉运凡</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科三班</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>260 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             id name  age gender clazz\n",
       "1    1500100002  吕金鹏   24      男  文科六班\n",
       "3    1500100004  葛德曜   24      男  理科三班\n",
       "12   1500100013  逯君昊   24      男  文科二班\n",
       "18   1500100019  娄曦之   24      男  理科三班\n",
       "27   1500100028  幸浩邈   24      男  理科五班\n",
       "..          ...  ...  ...    ...   ...\n",
       "988  1500100989  柏盼香   24      女  理科六班\n",
       "991  1500100992  莫运盛   24      男  理科六班\n",
       "993  1500100994  相凌青   24      女  理科四班\n",
       "994  1500100995  寿芷卉   24      女  理科五班\n",
       "995  1500100996  厉运凡   24      男  文科三班\n",
       "\n",
       "[260 rows x 5 columns]"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 布尔索引\n",
    "stuDF[stuDF['age']>23]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "e8d8878e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "      <th>clazz</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>1500100996</td>\n",
       "      <td>厉运凡</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科三班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>1500100997</td>\n",
       "      <td>陶敬曦</td>\n",
       "      <td>21</td>\n",
       "      <td>男</td>\n",
       "      <td>理科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>1500100998</td>\n",
       "      <td>容昆宇</td>\n",
       "      <td>22</td>\n",
       "      <td>男</td>\n",
       "      <td>理科四班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>1500100999</td>\n",
       "      <td>钟绮晴</td>\n",
       "      <td>23</td>\n",
       "      <td>女</td>\n",
       "      <td>文科五班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>1500101000</td>\n",
       "      <td>符瑞渊</td>\n",
       "      <td>23</td>\n",
       "      <td>男</td>\n",
       "      <td>理科六班</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             id name  age gender clazz\n",
       "995  1500100996  厉运凡   24      男  文科三班\n",
       "996  1500100997  陶敬曦   21      男  理科六班\n",
       "997  1500100998  容昆宇   22      男  理科四班\n",
       "998  1500100999  钟绮晴   23      女  文科五班\n",
       "999  1500101000  符瑞渊   23      男  理科六班"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stuDF.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "35a433f6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 1000 entries, 0 to 999\n",
      "Data columns (total 5 columns):\n",
      " #   Column  Non-Null Count  Dtype \n",
      "---  ------  --------------  ----- \n",
      " 0   id      1000 non-null   int64 \n",
      " 1   name    1000 non-null   object\n",
      " 2   age     1000 non-null   int64 \n",
      " 3   gender  1000 non-null   object\n",
      " 4   clazz   1000 non-null   object\n",
      "dtypes: int64(2), object(3)\n",
      "memory usage: 39.2+ KB\n"
     ]
    }
   ],
   "source": [
    "stuDF.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "0a5dc097",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>1.000000e+03</td>\n",
       "      <td>1000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>1.500101e+09</td>\n",
       "      <td>22.521000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>2.888194e+02</td>\n",
       "      <td>1.113013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>1.500100e+09</td>\n",
       "      <td>21.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>1.500100e+09</td>\n",
       "      <td>22.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>1.500101e+09</td>\n",
       "      <td>22.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>1.500101e+09</td>\n",
       "      <td>24.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>1.500101e+09</td>\n",
       "      <td>24.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 id          age\n",
       "count  1.000000e+03  1000.000000\n",
       "mean   1.500101e+09    22.521000\n",
       "std    2.888194e+02     1.113013\n",
       "min    1.500100e+09    21.000000\n",
       "25%    1.500100e+09    22.000000\n",
       "50%    1.500101e+09    22.000000\n",
       "75%    1.500101e+09    24.000000\n",
       "max    1.500101e+09    24.000000"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stuDF.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "19a17018",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
